﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;

namespace LogicCircuit
{
    [Serializable]

    public class Or:Element
    {
        private int _output;
        public Connection InputA { get; set; }
        public Connection InputB { get; set; }
        public Or(int x, int y)
        {
            X = x;
            Y = y;
            Output = -1;
            type = "Or";
        }
        public int Output
        {
            get
            {
                if (InputA != null && InputB != null)
                {
                    if (InputA.Value == 0 && InputB.Value == 0)
                        return 0;
                    else if (InputA.Value == 0 && InputB.Value == 1)
                        return 1;
                    else if (InputA.Value == 1 && InputB.Value == 0)
                        return 1;

                    else if (InputA.Value == 1 && InputB.Value == 1)
                        return 1;

                    else
                        return -1;
                }
                else
                    return -1;

            }
            set
            {
                _output = value;
            }
        }
    }
}
